<template>
	<div class="updatemovie-wrapper">
		<el-table :data="movice_list" class='text-center'>
			<el-table-column prop="title" label="电影名称"></el-table-column>
			<el-table-column prop="doctor" label="导演"></el-table-column>
			<el-table-column prop="country" label="国家"></el-table-column>
			<el-table-column prop="year" label="上映年份"></el-table-column>
			<el-table-column prop="meta.createAt" label="录入时间">
				<template slot-scope="scope">
					{{scope.row.meta.createAt.slice(0,10)}}
				</template>
			</el-table-column>
			<el-table-column label="查看">
				<template slot-scope="scope">
					<router-link :to="/movie_details/+scope.row._id">
						<el-button>查看</el-button>
					</router-link>
				</template>
			</el-table-column>
			<el-table-column label="更新">
				<template slot-scope="scope">
					<router-link :to="'/admin/updatemovie/'+scope.row._id">
						<el-button>修改</el-button>
					</router-link>
				</template>
			</el-table-column>
			<el-table-column label="删除">
				<template slot-scope="scope">
					<el-button type="danger">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
	const request = require('@/api/movies.js')
	export default {
		name: "updatemovie",
		data() {
			return {
				movice_list: [],
			}
		},
		created() {
			this.doRequestgetmovies()
		},
		methods: {
			doRequestgetmovies() {
				const id = this.$route.query.id
				request.getmovies({
					id: id
				}).then(res => {
					console.log(res)
					this.movice_list = res.data
				})

			}
		}
	}
</script>

<style>

</style>